/**
 * Copyright (c) 2020 kedacom
 * OpenATC is licensed under Mulan PSL v2.
 * You can use this software according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of Mulan PSL v2 at:
 * http://license.coscl.org.cn/MulanPSL2
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
 * See the Mulan PSL v2 for more details.
 **/
<template>
  <div class="home-search-panel">
    <Search :isShrink="isShrink" @changeShrink="changeShrink" @doSearch="doSearch" />
    <Result ref="resultPanel" :isShrink="isShrink" :searchfilter="searchfilter" @treeNodeClick="treeNodeClick" @handleClickItem="handleClickItem" @changeType="changeType" />
  </div>
</template>

<script>
import Search from './search'
import Result from './result'
export default {
  name: 'homeSearchPanel',
  data () {
    return {
      isShrink: false,
      searchfilter: ''
    }
  },
  components: {
    Search,
    Result
  },
  props: {

  },
  watch: {

  },
  methods: {
    changeShrink (isShrink) {
      this.isShrink = isShrink
    },
    doSearch (searchfilter) {
      this.searchfilter = searchfilter
      this.$refs.resultPanel.doSearch(searchfilter)
    },
    treeNodeClick (data) {
      this.$emit('treeNodeClick', data)
    },
    handleClickItem (data) {
      this.$emit('handleClickItem', data)
    },
    changeType (type) {
      this.$emit('changeType', type)
    }
  },
  mounted () {

  }
}
</script>

<style lang="scss" rel="stylesheet/scss" scoped>
</style>
